/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.mblj.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "cargos")
@NamedQueries({@NamedQuery(name = "Cargos.findAll", query = "SELECT c FROM Cargos c"), @NamedQuery(name = "Cargos.findByCgId", query = "SELECT c FROM Cargos c WHERE c.cgId = :cgId"), @NamedQuery(name = "Cargos.findByCgDescripcion", query = "SELECT c FROM Cargos c WHERE c.cgDescripcion = :cgDescripcion")})
public class Cargos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cg_id")
    private Integer cgId;
    @Column(name = "cg_descripcion")
    private String cgDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reCargo", fetch = FetchType.LAZY)
    private List<Responsables> responsablesList;

    public Cargos() {
    }

    public Cargos(Integer cgId) {
        this.cgId = cgId;
    }

    public Integer getCgId() {
        return cgId;
    }

    public void setCgId(Integer cgId) {
        this.cgId = cgId;
    }

    public String getCgDescripcion() {
        return cgDescripcion;
    }

    public void setCgDescripcion(String cgDescripcion) {
        this.cgDescripcion = cgDescripcion;
    }

    public List<Responsables> getResponsablesList() {
        return responsablesList;
    }

    public void setResponsablesList(List<Responsables> responsablesList) {
        this.responsablesList = responsablesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cgId != null ? cgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cargos)) {
            return false;
        }
        Cargos other = (Cargos) object;
        if ((this.cgId == null && other.cgId != null) || (this.cgId != null && !this.cgId.equals(other.cgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.mblj.domain.Cargos[cgId=" + cgId + "]";
    }

}
